package com.tom.demo.service.dashboard.impl;

import com.tom.demo.common.response.Result;
import com.tom.demo.mapper.OaProcessTypeMapper;
import com.tom.demo.mapper.SysDeptMapper;
import com.tom.demo.service.dashboard.DashboardService;
import com.tom.demo.vo.Deprecates;
import com.tom.demo.vo.DeptEchartsVo;
import com.tom.demo.vo.ProcessDefinitionVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Slf4j
@Service
public class DashboardServiceImpl implements DashboardService {
    @Resource
    private SysDeptMapper sysDeptMapper;

    @Resource
    private OaProcessTypeMapper oaProcessTypeMapper;

    @Override
    public Result deptEcharts() {
        DeptEchartsVo deptEchartsVo = new DeptEchartsVo();
        deptEchartsVo.setTitle("部门人数统计");
        List<Deprecates> echartsData = sysDeptMapper.findByDeptEchartsData();
        deptEchartsVo.setEchartsData(echartsData);
        return Result.success(deptEchartsVo);
    }

    @Override
    public Result getProcessDefinitions() {
        List<ProcessDefinitionVo> processDefinitionVos = oaProcessTypeMapper.findByTypeGroupBy();
        return Result.success(processDefinitionVos);
    }
}
